import request from "@/utils/request";

// 部门列表
export function getbranch(method, data) {
  if (method == "post") {
    return request({
      url: "/branch",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/branch",
      method: method,
      params: data,
    });
  }
}

// 部门列表
export function getbranchinfo(data) {
  return request({
    url: "/branch/info",
    method: "get",
    data,
  });
}

// 部门树结构
export function getbranchtree(data) {
  return request({
    url: "/branch/tree",
    method: "get",
    data,
  });
}

// 绑定部门
export function getbranchbind(data) {
  return request({
    url: "/branch/bind",
    method: "post",
    data,
  });
}


// 角色列表
export function getrole(method, data) {
  if (method == "post") {
    return request({
      url: "/role",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/role",
      method: method,
      params: data,
    });
  }
}


// 角色信息
export function getroleinfo(data) {
  // console.log(data)
  return request({
    url: "/role/info",
    method: "get",
    params: data,
  });
}

// 解冻账号
export function unfreeze(data) {
  return request({
    url: "/admin/unfreeze",
    method: "post",
    data,
  });
}

// 冻结账号
export function freeze(data) {
  return request({
    url: "/admin/freeze",
    method: "post",
    data,
  });
}

// 部门搜索
export function branchsearch(params) {
  return request({
    url: "/branch/search",
    method: "get",
    params,
  });
}

// 角色搜索
export function rolesearch(params) {
  return request({
    url: "/role/search",
    method: "get",
    params,
  });
}